Scenario #9220: Create Person and Subject and Account with a Single Request

UseCase Create Account For New Person => Account: xyz-peter.newman

An account combines an RBAC subject with a natural person and thus grant’s access to data in hsadmin-NG. Here, the natural person, the USER subject (with a UUID e.g. known from Keycloak), and the account are all created with a single HTTP POST request — executed by a global-admin subject which has no own account itself.

Properties

Required

Given

name value
personFamilyName Newman
personGivenName Peter
subjectUuid 242a0003-0000-0000-0000-000000000003
subjectName xyz-peter.newman
globalUid 21012
globalGid 21012

newAccount

HTTP POST "/api/hs/accounts/accounts" \
  -H "Authorization: Bearer $HSADMINNG_JWT_BEARER" \
  `# {` \
  `#   "sub" : "uuid<hsh-keycloak_sync>"` \
  `# }` \
  -H 'Content-Type: application/json' \
  --data-binary @- <<EOF
{
  "person" : {
    "personType" : "NATURAL_PERSON",
    "salutation" : "Hallo",
    "givenName" : "Peter",
    "familyName" : "Newman"
  },
  "subject" : {
    "uuid" : "242a0003-0000-0000-0000-000000000003",
    "name" : "xyz-peter.newman"
  },
  "globalUid" : 21012,
  "globalGid" : 21012
}
EOF
=> status: 201 CREATED 242a0003-0000-0000-0000-000000000003

Person: Peter Newman

HTTP GET "/api/hs/office/persons?name=Newman" \
  -H "Authorization: Bearer $HSADMINNG_JWT_BEARER" \
  `# {` \
  `#   "sub" : "uuid<hsh-keycloak_sync>"` \
  `# }`
=> status: 200 OK 
[ {
  "uuid" : "7f207c26-2d88-4863-9bbf-84d4b4bbd7c4",
  "personType" : "NATURAL_PERSON",
  "tradeName" : null,
  "salutation" : "Hallo",
  "title" : null,
  "givenName" : "Peter",
  "familyName" : "Newman"
} ]

In real situations we have more precise measures to find the related person.

Verify the new Account as its own Subject

HTTP GET "/api/hs/accounts/accounts/242a0003-0000-0000-0000-000000000003" // newAccount \
  -H "Authorization: Bearer $HSADMINNG_JWT_BEARER" \
  `# {` \
  `#   "sub" : "uuid<xyz-peter.newman>"` \
  `# }`
=> status: 200 OK 
{
  "uuid" : "242a0003-0000-0000-0000-000000000003", // newAccount
  "person" : {
    "uuid" : "7f207c26-2d88-4863-9bbf-84d4b4bbd7c4", // Person: Peter Newman
    "personType" : "NATURAL_PERSON",
    "tradeName" : null,
    "salutation" : "Hallo",
    "title" : null,
    "givenName" : "Peter",
    "familyName" : "Newman"
  },
  "subject" : {
    "uuid" : "242a0003-0000-0000-0000-000000000003", // newAccount
    "name" : "xyz-peter.newman",
    "type" : "USER"
  },
  "globalUid" : 21012,
  "globalGid" : 21012
}

generated on 2026-07-17 01:42:19 for branch